import 'package:flutter/material.dart';
import 'package:flutter_e_commerece/components/product_card.dart';
import 'package:flutter_e_commerece/models/Product.dart';
import 'package:flutter_e_commerece/screens/home/components/section_title.dart';

import '../../../size_config.dart';

class PopularProducts extends StatelessWidget {
  const PopularProducts({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        Padding(
          padding: EdgeInsets.symmetric(
            horizontal: getProportionateScreenWidth(20),
          ),
          child: SectionTitle(
            title: "Special for you",
            press: () {},
          ),
        ),
        SizedBox(height: getProportionateScreenHeight(20)),
        SingleChildScrollView(
          scrollDirection: Axis.horizontal,
          child: Row(children: [
            ...List.generate(demoProducts.length, (index) {
              return demoProducts[index].isPopular
                  ? ProductCard(product: demoProducts[index])
                  : SizedBox.shrink();
            })
          ]),
        ),
        SizedBox(width: getProportionateScreenWidth(20)),
      ],
    );
  }
}
